﻿//////////////////////////////////////////////////////////////////////////////
//
// Copyright © 1998-2024 Glodon Company Limited.
//
// Licensed under the MIT License
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the “Software”),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//////////////////////////////////////////////////////////////////////////////


#include "DebugMessage.h"
#include "QKeyTextMap.h"
#include "EnableCompileWarning_The_LAST_IncludeInCpp.h"

using namespace gcmp;

QKeyTextMap::QKeyTextMap( void )
{
    InitializeKeyText();
    InitializeModifierText();
}

QKeyTextMap::~QKeyTextMap( void )
{

}

std::wstring QKeyTextMap::GetQKeyText( int key ) const
{
    auto iter = m_qKeyTextMap.find(key);
    if (iter == m_qKeyTextMap.end())
    {
        DBG_WARN(L"无效key", L"paramodel", L"2024-02-20");
        return L"";
    }
    else
    {
        return (*iter).second;
    }
}

std::wstring QKeyTextMap::GetQKeyboardModifierText( int modifier ) const
{
    auto iter = m_qModifierTextMap.find(modifier);
    if (iter == m_qModifierTextMap.end())
    {
        DBG_WARN(L"无效modifier", L"paramodel", L"2024-02-20");
        return L"";
    }
    else
    {
        return (*iter).second;
    }
}

int QKeyTextMap::GetQkey( const std::wstring& keyText ) const
{
    auto iter = m_qTextKeyMap.find(keyText);
    if (iter == m_qTextKeyMap.end())
    {
        DBG_WARN(L"无效keyText", L"paramodel", L"2024-02-20");
        return -1;
    }
    else
    {
        return (*iter).second;
    }
}

int QKeyTextMap::GetQKeyboardModifier( const std::wstring& modifierText ) const
{
    auto iter = m_qTextModifierMap.find(modifierText);
    if (iter == m_qTextModifierMap.end())
    {
        DBG_WARN(L"无效modifierText", L"paramodel", L"2024-02-20");
        return -1;
    }
    else
    {
        return (*iter).second;
    }
}

void QKeyTextMap::InitializeKeyText( void )
{
    m_qKeyTextMap[Key_Escape]                       = L"Escape";
    m_qKeyTextMap[Key_Tab]                          = L"Tab";
    m_qKeyTextMap[Key_Backtab]                      = L"Backtab";
    m_qKeyTextMap[Key_Backspace]                    = L"Backspace";
    m_qKeyTextMap[Key_Return]                       = L"Return";
    m_qKeyTextMap[Key_Enter]                        = L"Enter";
    m_qKeyTextMap[Key_Insert]                       = L"Insert";
    m_qKeyTextMap[Key_Delete]                       = L"Delete";
    m_qKeyTextMap[Key_Pause]                        = L"Pause";
    m_qKeyTextMap[Key_Print]                        = L"Print";
    m_qKeyTextMap[Key_SysReq]                       = L"SysReq";
    m_qKeyTextMap[Key_Clear]                        = L"Clear";
    m_qKeyTextMap[Key_Home]                         = L"Home";
    m_qKeyTextMap[Key_End]                          = L"End";
    m_qKeyTextMap[Key_Left]                         = L"Left";
    m_qKeyTextMap[Key_Up]                           = L"Up";
    m_qKeyTextMap[Key_Right]                        = L"Right";
    m_qKeyTextMap[Key_Down]                         = L"Down";
    m_qKeyTextMap[Key_PageUp]                       = L"PageUp";
    m_qKeyTextMap[Key_PageDown]                     = L"PageDown";
    m_qKeyTextMap[Key_Shift]                        = L"Shift";
    m_qKeyTextMap[Key_Control]                      = L"Control";
    m_qKeyTextMap[Key_Meta]                         = L"Meta";
    m_qKeyTextMap[Key_Alt]                          = L"Alt";
    m_qKeyTextMap[Key_CapsLock]                     = L"CapsLock";
    m_qKeyTextMap[Key_NumLock]                      = L"NumLock";
    m_qKeyTextMap[Key_ScrollLock]                   = L"ScrollLock";
    m_qKeyTextMap[Key_F1]                           = L"F1";
    m_qKeyTextMap[Key_F2]                           = L"F2";
    m_qKeyTextMap[Key_F3]                           = L"F3";
    m_qKeyTextMap[Key_F4]                           = L"F4";
    m_qKeyTextMap[Key_F5]                           = L"F5";
    m_qKeyTextMap[Key_F6]                           = L"F6";
    m_qKeyTextMap[Key_F7]                           = L"F7";
    m_qKeyTextMap[Key_F8]                           = L"F8";
    m_qKeyTextMap[Key_F9]                           = L"F9";
    m_qKeyTextMap[Key_F10]                          = L"F10";
    m_qKeyTextMap[Key_F11]                          = L"F11";
    m_qKeyTextMap[Key_F12]                          = L"F12";
    m_qKeyTextMap[Key_F13]                          = L"F13";
    m_qKeyTextMap[Key_F14]                          = L"F14";
    m_qKeyTextMap[Key_F15]                          = L"F15";
    m_qKeyTextMap[Key_F16]                          = L"F16";
    m_qKeyTextMap[Key_F17]                          = L"F17";
    m_qKeyTextMap[Key_F18]                          = L"F18";
    m_qKeyTextMap[Key_F19]                          = L"F19";
    m_qKeyTextMap[Key_F20]                          = L"F20";
    m_qKeyTextMap[Key_F21]                          = L"F21";
    m_qKeyTextMap[Key_F22]                          = L"F22";
    m_qKeyTextMap[Key_F23]                          = L"F23";
    m_qKeyTextMap[Key_F24]                          = L"F24";
    m_qKeyTextMap[Key_F25]                          = L"F25";
    m_qKeyTextMap[Key_F26]                          = L"F26";
    m_qKeyTextMap[Key_F27]                          = L"F27";
    m_qKeyTextMap[Key_F28]                          = L"F28";
    m_qKeyTextMap[Key_F29]                          = L"F29";
    m_qKeyTextMap[Key_F30]                          = L"F30";
    m_qKeyTextMap[Key_F31]                          = L"F31";
    m_qKeyTextMap[Key_F32]                          = L"F32";
    m_qKeyTextMap[Key_F33]                          = L"F33";
    m_qKeyTextMap[Key_F34]                          = L"F34";
    m_qKeyTextMap[Key_F35]                          = L"F35";
    m_qKeyTextMap[Key_Super_L]                      = L"Super_L";
    m_qKeyTextMap[Key_Super_R]                      = L"Super_R";
    m_qKeyTextMap[Key_Menu]                         = L"Menu";
    m_qKeyTextMap[Key_Hyper_L]                      = L"Hyper_L";
    m_qKeyTextMap[Key_Hyper_R]                      = L"Hyper_R";
    m_qKeyTextMap[Key_Help]                         = L"Help";
    m_qKeyTextMap[Key_Direction_L]                  = L"Direction_L";
    m_qKeyTextMap[Key_Direction_R]                  = L"Direction_R";
    m_qKeyTextMap[Key_Space]                        = L"Space";
    m_qKeyTextMap[Key_Any]                          = L"Any";
    m_qKeyTextMap[Key_Exclam]                       = L"Exclam";
    m_qKeyTextMap[Key_QuoteDbl]                     = L"QuoteDbl";
    m_qKeyTextMap[Key_NumberSign]                   = L"NumberSign";
    m_qKeyTextMap[Key_Dollar]                       = L"Dollar";
    m_qKeyTextMap[Key_Percent]                      = L"Percent";
    m_qKeyTextMap[Key_Ampersand]                    = L"Ampersand";
    m_qKeyTextMap[Key_Apostrophe]                   = L"Apostrophe";
    m_qKeyTextMap[Key_ParenLeft]                    = L"ParenLeft";
    m_qKeyTextMap[Key_ParenRight]                   = L"ParenRight";
    m_qKeyTextMap[Key_Asterisk]                     = L"Asterisk";
    m_qKeyTextMap[Key_Plus]                         = L"Plus";
    m_qKeyTextMap[Key_Comma]                        = L"Comma";
    m_qKeyTextMap[Key_Minus]                        = L"Minus";
    m_qKeyTextMap[Key_Period]                       = L"Period";
    m_qKeyTextMap[Key_Slash]                        = L"Slash";
    m_qKeyTextMap[Key_0]                            = L"0";
    m_qKeyTextMap[Key_1]                            = L"1";
    m_qKeyTextMap[Key_2]                            = L"2";
    m_qKeyTextMap[Key_3]                            = L"3";
    m_qKeyTextMap[Key_4]                            = L"4";
    m_qKeyTextMap[Key_5]                            = L"5";
    m_qKeyTextMap[Key_6]                            = L"6";
    m_qKeyTextMap[Key_7]                            = L"7";
    m_qKeyTextMap[Key_8]                            = L"8";
    m_qKeyTextMap[Key_9]                            = L"9";
    m_qKeyTextMap[Key_Colon]                        = L"Colon";
    m_qKeyTextMap[Key_Semicolon]                    = L"Semicolon";
    m_qKeyTextMap[Key_Less]                         = L"Less";
    m_qKeyTextMap[Key_Equal]                        = L"Equal";
    m_qKeyTextMap[Key_Greater]                      = L"Greater";
    m_qKeyTextMap[Key_Question]                     = L"Question";
    m_qKeyTextMap[Key_At]                           = L"At";
    m_qKeyTextMap[Key_A]                            = L"A";
    m_qKeyTextMap[Key_B]                            = L"B";
    m_qKeyTextMap[Key_C]                            = L"C";
    m_qKeyTextMap[Key_D]                            = L"D";
    m_qKeyTextMap[Key_E]                            = L"E";
    m_qKeyTextMap[Key_F]                            = L"F";
    m_qKeyTextMap[Key_G]                            = L"G";
    m_qKeyTextMap[Key_H]                            = L"H";
    m_qKeyTextMap[Key_I]                            = L"I";
    m_qKeyTextMap[Key_J]                            = L"J";
    m_qKeyTextMap[Key_K]                            = L"K";
    m_qKeyTextMap[Key_L]                            = L"L";
    m_qKeyTextMap[Key_M]                            = L"M";
    m_qKeyTextMap[Key_N]                            = L"N";
    m_qKeyTextMap[Key_O]                            = L"O";
    m_qKeyTextMap[Key_P]                            = L"P";
    m_qKeyTextMap[Key_Q]                            = L"Q";
    m_qKeyTextMap[Key_R]                            = L"R";
    m_qKeyTextMap[Key_S]                            = L"S";
    m_qKeyTextMap[Key_T]                            = L"T";
    m_qKeyTextMap[Key_U]                            = L"U";
    m_qKeyTextMap[Key_V]                            = L"V";
    m_qKeyTextMap[Key_W]                            = L"W";
    m_qKeyTextMap[Key_X]                            = L"X";
    m_qKeyTextMap[Key_Y]                            = L"Y";
    m_qKeyTextMap[Key_Z]                            = L"Z";
    m_qKeyTextMap[Key_BracketLeft]                  = L"BracketLeft";
    m_qKeyTextMap[Key_Backslash]                    = L"Backslash";
    m_qKeyTextMap[Key_BracketRight]                 = L"BracketRight";
    m_qKeyTextMap[Key_AsciiCircum]                  = L"AsciiCircum";
    m_qKeyTextMap[Key_Underscore]                   = L"Underscore";
    m_qKeyTextMap[Key_QuoteLeft]                    = L"QuoteLeft";
    m_qKeyTextMap[Key_BraceLeft]                    = L"BraceLeft";
    m_qKeyTextMap[Key_Bar]                          = L"Bar";
    m_qKeyTextMap[Key_BraceRight]                   = L"BraceRight";
    m_qKeyTextMap[Key_AsciiTilde]                   = L"AsciiTilde";
    m_qKeyTextMap[Key_nobreakspace]                 = L"nobreakspace";
    m_qKeyTextMap[Key_exclamdown]                   = L"exclamdown";
    m_qKeyTextMap[Key_cent]                         = L"cent";
    m_qKeyTextMap[Key_sterling]                     = L"sterling";
    m_qKeyTextMap[Key_currency]                     = L"currency";
    m_qKeyTextMap[Key_yen]                          = L"yen";
    m_qKeyTextMap[Key_brokenbar]                    = L"brokenbar";
    m_qKeyTextMap[Key_section]                      = L"section";
    m_qKeyTextMap[Key_diaeresis]                    = L"diaeresis";
    m_qKeyTextMap[Key_copyright]                    = L"copyright";
    m_qKeyTextMap[Key_ordfeminine]                  = L"ordfeminine";
    m_qKeyTextMap[Key_guillemotleft]                = L"guillemotleft";
    m_qKeyTextMap[Key_notsign]                      = L"notsign";
    m_qKeyTextMap[Key_hyphen]                       = L"hyphen";
    m_qKeyTextMap[Key_registered]                   = L"registered";
    m_qKeyTextMap[Key_macron]                       = L"macron";
    m_qKeyTextMap[Key_degree]                       = L"degree";
    m_qKeyTextMap[Key_plusminus]                    = L"plusminus";
    m_qKeyTextMap[Key_twosuperior]                  = L"twosuperior";
    m_qKeyTextMap[Key_threesuperior]                = L"threesuperior";
    m_qKeyTextMap[Key_acute]                        = L"acute";
    m_qKeyTextMap[Key_mu]                           = L"mu";
    m_qKeyTextMap[Key_paragraph]                    = L"paragraph";
    m_qKeyTextMap[Key_periodcentered]               = L"periodcentered";
    m_qKeyTextMap[Key_cedilla]                      = L"cedilla";
    m_qKeyTextMap[Key_onesuperior]                  = L"onesuperior";
    m_qKeyTextMap[Key_masculine]                    = L"masculine";
    m_qKeyTextMap[Key_guillemotright]               = L"guillemotright";
    m_qKeyTextMap[Key_onequarter]                   = L"onequarter";
    m_qKeyTextMap[Key_onehalf]                      = L"onehalf";
    m_qKeyTextMap[Key_threequarters]                = L"threequarters";
    m_qKeyTextMap[Key_questiondown]                 = L"questiondown";
    m_qKeyTextMap[Key_Agrave]                       = L"Agrave";
    m_qKeyTextMap[Key_Aacute]                       = L"Aacute";
    m_qKeyTextMap[Key_Acircumflex]                  = L"Acircumflex";
    m_qKeyTextMap[Key_Atilde]                       = L"Atilde";
    m_qKeyTextMap[Key_Adiaeresis]                   = L"Adiaeresis";
    m_qKeyTextMap[Key_Aring]                        = L"Aring";
    m_qKeyTextMap[Key_AE]                           = L"AE";
    m_qKeyTextMap[Key_Ccedilla]                     = L"Ccedilla";
    m_qKeyTextMap[Key_Egrave]                       = L"Egrave";
    m_qKeyTextMap[Key_Eacute]                       = L"Eacute";
    m_qKeyTextMap[Key_Ecircumflex]                  = L"Ecircumflex";
    m_qKeyTextMap[Key_Ediaeresis]                   = L"Ediaeresis";
    m_qKeyTextMap[Key_Igrave]                       = L"Igrave";
    m_qKeyTextMap[Key_Iacute]                       = L"Iacute";
    m_qKeyTextMap[Key_Icircumflex]                  = L"Icircumflex";
    m_qKeyTextMap[Key_Idiaeresis]                   = L"Idiaeresis";
    m_qKeyTextMap[Key_ETH]                          = L"ETH";
    m_qKeyTextMap[Key_Ntilde]                       = L"Ntilde";
    m_qKeyTextMap[Key_Ograve]                       = L"Ograve";
    m_qKeyTextMap[Key_Oacute]                       = L"Oacute";
    m_qKeyTextMap[Key_Ocircumflex]                  = L"Ocircumflex";
    m_qKeyTextMap[Key_Otilde]                       = L"Otilde";
    m_qKeyTextMap[Key_Odiaeresis]                   = L"Odiaeresis";
    m_qKeyTextMap[Key_multiply]                     = L"multiply";
    m_qKeyTextMap[Key_Ooblique]                     = L"Ooblique";
    m_qKeyTextMap[Key_Ugrave]                       = L"Ugrave";
    m_qKeyTextMap[Key_Uacute]                       = L"Uacute";
    m_qKeyTextMap[Key_Ucircumflex]                  = L"Ucircumflex";
    m_qKeyTextMap[Key_Udiaeresis]                   = L"Udiaeresis";
    m_qKeyTextMap[Key_Yacute]                       = L"Yacute";
    m_qKeyTextMap[Key_THORN]                        = L"THORN";
    m_qKeyTextMap[Key_ssharp]                       = L"ssharp";
    m_qKeyTextMap[Key_division]                     = L"division";
    m_qKeyTextMap[Key_ydiaeresis]                   = L"ydiaeresis";
    m_qKeyTextMap[Key_AltGr]                        = L"AltGr";
    m_qKeyTextMap[Key_Multi_key]                    = L"Multi_key";
    m_qKeyTextMap[Key_Codeinput]                    = L"Codeinput";
    m_qKeyTextMap[Key_SingleCandidate]              = L"SingleCandidate";
    m_qKeyTextMap[Key_MultipleCandidate]            = L"MultipleCandidate";
    m_qKeyTextMap[Key_PreviousCandidate]            = L"PreviousCandidate";
    m_qKeyTextMap[Key_Mode_switch]                  = L"Mode_switch";
    m_qKeyTextMap[Key_Kanji]                        = L"Kanji";
    m_qKeyTextMap[Key_Muhenkan]                     = L"Muhenkan";
    m_qKeyTextMap[Key_Henkan]                       = L"Henkan";
    m_qKeyTextMap[Key_Romaji]                       = L"Romaji";
    m_qKeyTextMap[Key_Hiragana]                     = L"Hiragana";
    m_qKeyTextMap[Key_Katakana]                     = L"Katakana";
    m_qKeyTextMap[Key_Hiragana_Katakana]            = L"Hiragana_Katakana";
    m_qKeyTextMap[Key_Zenkaku]                      = L"Zenkaku";
    m_qKeyTextMap[Key_Hankaku]                      = L"Hankaku";
    m_qKeyTextMap[Key_Zenkaku_Hankaku]              = L"Zenkaku_Hankaku";
    m_qKeyTextMap[Key_Touroku]                      = L"Touroku";
    m_qKeyTextMap[Key_Massyo]                       = L"Massyo";
    m_qKeyTextMap[Key_Kana_Lock]                    = L"Kana_Lock";
    m_qKeyTextMap[Key_Kana_Shift]                   = L"Kana_Shift";
    m_qKeyTextMap[Key_Eisu_Shift]                   = L"Eisu_Shift";
    m_qKeyTextMap[Key_Eisu_toggle]                  = L"Eisu_toggle";
    m_qKeyTextMap[Key_Hangul]                       = L"Hangul";
    m_qKeyTextMap[Key_Hangul_Start]                 = L"Hangul_Start";
    m_qKeyTextMap[Key_Hangul_End]                   = L"Hangul_End";
    m_qKeyTextMap[Key_Hangul_Hanja]                 = L"Hangul_Hanja";
    m_qKeyTextMap[Key_Hangul_Jamo]                  = L"Hangul_Jamo";
    m_qKeyTextMap[Key_Hangul_Romaja]                = L"Hangul_Romaja";
    m_qKeyTextMap[Key_Hangul_Jeonja]                = L"Hangul_Jeonja";
    m_qKeyTextMap[Key_Hangul_Banja]                 = L"Hangul_Banja";
    m_qKeyTextMap[Key_Hangul_PreHanja]              = L"Hangul_PreHanja";
    m_qKeyTextMap[Key_Hangul_PostHanja]             = L"Hangul_PostHanja";
    m_qKeyTextMap[Key_Hangul_Special]               = L"Hangul_Special";
    m_qKeyTextMap[Key_Dead_Grave]                   = L"Dead_Grave";
    m_qKeyTextMap[Key_Dead_Acute]                   = L"Dead_Acute";
    m_qKeyTextMap[Key_Dead_Circumflex]              = L"Dead_Circumflex";
    m_qKeyTextMap[Key_Dead_Tilde]                   = L"Dead_Tilde";
    m_qKeyTextMap[Key_Dead_Macron]                  = L"Dead_Macron";
    m_qKeyTextMap[Key_Dead_Breve]                   = L"Dead_Breve";
    m_qKeyTextMap[Key_Dead_Abovedot]                = L"Dead_Abovedot";
    m_qKeyTextMap[Key_Dead_Diaeresis]               = L"Dead_Diaeresis";
    m_qKeyTextMap[Key_Dead_Abovering]               = L"Dead_Abovering";
    m_qKeyTextMap[Key_Dead_Doubleacute]             = L"Dead_Doubleacute";
    m_qKeyTextMap[Key_Dead_Caron]                   = L"Dead_Caron";
    m_qKeyTextMap[Key_Dead_Cedilla]                 = L"Dead_Cedilla";
    m_qKeyTextMap[Key_Dead_Ogonek]                  = L"Dead_Ogonek";
    m_qKeyTextMap[Key_Dead_Iota]                    = L"Dead_Iota";
    m_qKeyTextMap[Key_Dead_Voiced_Sound]            = L"Dead_Voiced_Sound";
    m_qKeyTextMap[Key_Dead_Semivoiced_Sound]        = L"Dead_Semivoiced_Sound";
    m_qKeyTextMap[Key_Dead_Belowdot]                = L"Dead_Belowdot";
    m_qKeyTextMap[Key_Dead_Hook]                    = L"Dead_Hook";
    m_qKeyTextMap[Key_Dead_Horn]                    = L"Dead_Horn";
    m_qKeyTextMap[Key_Back]                         = L"Back";
    m_qKeyTextMap[Key_Forward]                      = L"Forward";
    m_qKeyTextMap[Key_Stop]                         = L"Stop";
    m_qKeyTextMap[Key_Refresh]                      = L"Refresh";
    m_qKeyTextMap[Key_VolumeDown]                   = L"VolumeDown";
    m_qKeyTextMap[Key_VolumeMute]                   = L"VolumeMute";
    m_qKeyTextMap[Key_VolumeUp]                     = L"VolumeUp";
    m_qKeyTextMap[Key_BassBoost]                    = L"BassBoost";
    m_qKeyTextMap[Key_BassUp]                       = L"BassUp";
    m_qKeyTextMap[Key_BassDown]                     = L"BassDown";
    m_qKeyTextMap[Key_TrebleUp]                     = L"TrebleUp";
    m_qKeyTextMap[Key_TrebleDown]                   = L"TrebleDown";
    m_qKeyTextMap[Key_MediaPlay]                    = L"MediaPlay";
    m_qKeyTextMap[Key_MediaStop]                    = L"MediaStop";
    m_qKeyTextMap[Key_MediaPrevious]                = L"MediaPrevious";
    m_qKeyTextMap[Key_MediaNext]                    = L"MediaNext";
    m_qKeyTextMap[Key_MediaRecord]                  = L"MediaRecord";
    m_qKeyTextMap[Key_MediaPause]                   = L"MediaPause";
    m_qKeyTextMap[Key_MediaTogglePlayPause]         = L"MediaTogglePlayPause";
    m_qKeyTextMap[Key_HomePage]                     = L"HomePage";
    m_qKeyTextMap[Key_Favorites]                    = L"Favorites";
    m_qKeyTextMap[Key_Search]                       = L"Search";
    m_qKeyTextMap[Key_Standby]                      = L"Standby";
    m_qKeyTextMap[Key_OpenUrl]                      = L"OpenUrl";
    m_qKeyTextMap[Key_LaunchMail]                   = L"LaunchMail";
    m_qKeyTextMap[Key_LaunchMedia]                  = L"LaunchMedia";
    m_qKeyTextMap[Key_Launch0]                      = L"Launch0";
    m_qKeyTextMap[Key_Launch1]                      = L"Launch1";
    m_qKeyTextMap[Key_Launch2]                      = L"Launch2";
    m_qKeyTextMap[Key_Launch3]                      = L"Launch3";
    m_qKeyTextMap[Key_Launch4]                      = L"Launch4";
    m_qKeyTextMap[Key_Launch5]                      = L"Launch5";
    m_qKeyTextMap[Key_Launch6]                      = L"Launch6";
    m_qKeyTextMap[Key_Launch7]                      = L"Launch7";
    m_qKeyTextMap[Key_Launch8]                      = L"Launch8";
    m_qKeyTextMap[Key_Launch9]                      = L"Launch9";
    m_qKeyTextMap[Key_LaunchA]                      = L"LaunchA";
    m_qKeyTextMap[Key_LaunchB]                      = L"LaunchB";
    m_qKeyTextMap[Key_LaunchC]                      = L"LaunchC";
    m_qKeyTextMap[Key_LaunchD]                      = L"LaunchD";
    m_qKeyTextMap[Key_LaunchE]                      = L"LaunchE";
    m_qKeyTextMap[Key_LaunchF]                      = L"LaunchF";
    m_qKeyTextMap[Key_MonBrightnessUp]              = L"MonBrightnessUp";
    m_qKeyTextMap[Key_MonBrightnessDown]            = L"MonBrightnessDown";
    m_qKeyTextMap[Key_KeyboardLightOnOff]           = L"KeyboardLightOnOff";
    m_qKeyTextMap[Key_KeyboardBrightnessUp]         = L"KeyboardBrightnessUp";
    m_qKeyTextMap[Key_KeyboardBrightnessDown]       = L"KeyboardBrightnessDown";
    m_qKeyTextMap[Key_PowerOff]                     = L"PowerOff";
    m_qKeyTextMap[Key_WakeUp]                       = L"WakeUp";
    m_qKeyTextMap[Key_Eject]                        = L"Eject";
    m_qKeyTextMap[Key_ScreenSaver]                  = L"ScreenSaver";
    m_qKeyTextMap[Key_WWW]                          = L"WWW";
    m_qKeyTextMap[Key_Memo]                         = L"Memo";
    m_qKeyTextMap[Key_LightBulb]                    = L"LightBulb";
    m_qKeyTextMap[Key_Shop]                         = L"Shop";
    m_qKeyTextMap[Key_History]                      = L"History";
    m_qKeyTextMap[Key_AddFavorite]                  = L"AddFavorite";
    m_qKeyTextMap[Key_HotLinks]                     = L"HotLinks";
    m_qKeyTextMap[Key_BrightnessAdjust]             = L"BrightnessAdjust";
    m_qKeyTextMap[Key_Finance]                      = L"Finance";
    m_qKeyTextMap[Key_Community]                    = L"Community";
    m_qKeyTextMap[Key_AudioRewind]                  = L"AudioRewind";
    m_qKeyTextMap[Key_BackForward]                  = L"BackForward";
    m_qKeyTextMap[Key_ApplicationLeft]              = L"ApplicationLeft";
    m_qKeyTextMap[Key_ApplicationRight]             = L"ApplicationRight";
    m_qKeyTextMap[Key_Book]                         = L"Book";
    m_qKeyTextMap[Key_CD]                           = L"CD";
    m_qKeyTextMap[Key_Calculator]                   = L"Calculator";
    m_qKeyTextMap[Key_ToDoList]                     = L"ToDoList";
    m_qKeyTextMap[Key_ClearGrab]                    = L"ClearGrab";
    m_qKeyTextMap[Key_Close]                        = L"Close";
    m_qKeyTextMap[Key_Copy]                         = L"Copy";
    m_qKeyTextMap[Key_Cut]                          = L"Cut";
    m_qKeyTextMap[Key_Display]                      = L"Display";
    m_qKeyTextMap[Key_DOS]                          = L"DOS";
    m_qKeyTextMap[Key_Documents]                    = L"Documents";
    m_qKeyTextMap[Key_Excel]                        = L"Excel";
    m_qKeyTextMap[Key_Explorer]                     = L"Explorer";
    m_qKeyTextMap[Key_Game]                         = L"Game";
    m_qKeyTextMap[Key_Go]                           = L"Go";
    m_qKeyTextMap[Key_iTouch]                       = L"iTouch";
    m_qKeyTextMap[Key_LogOff]                       = L"LogOff";
    m_qKeyTextMap[Key_Market]                       = L"Market";
    m_qKeyTextMap[Key_Meeting]                      = L"Meeting";
    m_qKeyTextMap[Key_MenuKB]                       = L"MenuKB";
    m_qKeyTextMap[Key_MenuPB]                       = L"MenuPB";
    m_qKeyTextMap[Key_MySites]                      = L"MySites";
    m_qKeyTextMap[Key_News]                         = L"News";
    m_qKeyTextMap[Key_OfficeHome]                   = L"OfficeHome";
    m_qKeyTextMap[Key_Option]                       = L"Option";
    m_qKeyTextMap[Key_Paste]                        = L"Paste";
    m_qKeyTextMap[Key_Phone]                        = L"Phone";
    m_qKeyTextMap[Key_Calendar]                     = L"Calendar";
    m_qKeyTextMap[Key_Reply]                        = L"Reply";
    m_qKeyTextMap[Key_Reload]                       = L"Reload";
    m_qKeyTextMap[Key_RotateWindows]                = L"RotateWindows";
    m_qKeyTextMap[Key_RotationPB]                   = L"RotationPB";
    m_qKeyTextMap[Key_RotationKB]                   = L"RotationKB";
    m_qKeyTextMap[Key_Save]                         = L"Save";
    m_qKeyTextMap[Key_Send]                         = L"Send";
    m_qKeyTextMap[Key_Spell]                        = L"Spell";
    m_qKeyTextMap[Key_SplitScreen]                  = L"SplitScreen";
    m_qKeyTextMap[Key_Support]                      = L"Support";
    m_qKeyTextMap[Key_TaskPane]                     = L"TaskPane";
    m_qKeyTextMap[Key_Terminal]                     = L"Terminal";
    m_qKeyTextMap[Key_Tools]                        = L"Tools";
    m_qKeyTextMap[Key_Travel]                       = L"Travel";
    m_qKeyTextMap[Key_Video]                        = L"Video";
    m_qKeyTextMap[Key_Word]                         = L"Word";
    m_qKeyTextMap[Key_Xfer]                         = L"Xfer";
    m_qKeyTextMap[Key_ZoomIn]                       = L"ZoomIn";
    m_qKeyTextMap[Key_ZoomOut]                      = L"ZoomOut";
    m_qKeyTextMap[Key_Away]                         = L"Away";
    m_qKeyTextMap[Key_Messenger]                    = L"Messenger";
    m_qKeyTextMap[Key_WebCam]                       = L"WebCam";
    m_qKeyTextMap[Key_MailForward]                  = L"MailForward";
    m_qKeyTextMap[Key_Pictures]                     = L"Pictures";
    m_qKeyTextMap[Key_Music]                        = L"Music";
    m_qKeyTextMap[Key_Battery]                      = L"Battery";
    m_qKeyTextMap[Key_Bluetooth]                    = L"Bluetooth";
    m_qKeyTextMap[Key_WLAN]                         = L"WLAN";
    m_qKeyTextMap[Key_UWB]                          = L"UWB";
    m_qKeyTextMap[Key_AudioForward]                 = L"AudioForward";
    m_qKeyTextMap[Key_AudioRepeat]                  = L"AudioRepeat";
    m_qKeyTextMap[Key_AudioRandomPlay]              = L"AudioRandomPlay";
    m_qKeyTextMap[Key_Subtitle]                     = L"Subtitle";
    m_qKeyTextMap[Key_AudioCycleTrack]              = L"AudioCycleTrack";
    m_qKeyTextMap[Key_Time]                         = L"Time";
    m_qKeyTextMap[Key_Hibernate]                    = L"Hibernate";
    m_qKeyTextMap[Key_View]                         = L"View";
    m_qKeyTextMap[Key_TopMenu]                      = L"TopMenu";
    m_qKeyTextMap[Key_PowerDown]                    = L"PowerDown";
    m_qKeyTextMap[Key_Suspend]                      = L"Suspend";
    m_qKeyTextMap[Key_ContrastAdjust]               = L"ContrastAdjust";
    m_qKeyTextMap[Key_LaunchG]                      = L"LaunchG";
    m_qKeyTextMap[Key_LaunchH]                      = L"LaunchH";
    m_qKeyTextMap[Key_TouchpadToggle]               = L"TouchpadToggle";
    m_qKeyTextMap[Key_TouchpadOn]                   = L"TouchpadOn";
    m_qKeyTextMap[Key_TouchpadOff]                  = L"TouchpadOff";
    m_qKeyTextMap[Key_MicMute]                      = L"MicMute";
    m_qKeyTextMap[Key_Red]                          = L"Red";
    m_qKeyTextMap[Key_Green]                        = L"Green";
    m_qKeyTextMap[Key_Yellow]                       = L"Yellow";
    m_qKeyTextMap[Key_Blue]                         = L"Blue";
    m_qKeyTextMap[Key_ChannelUp]                    = L"ChannelUp";
    m_qKeyTextMap[Key_ChannelDown]                  = L"ChannelDown";
    m_qKeyTextMap[Key_Guide]                        = L"Guide";
    m_qKeyTextMap[Key_Info]                         = L"Info";
    m_qKeyTextMap[Key_Settings]                     = L"Settings";
    m_qKeyTextMap[Key_MicVolumeUp]                  = L"MicVolumeUp";
    m_qKeyTextMap[Key_MicVolumeDown]                = L"MicVolumeDown";
    m_qKeyTextMap[Key_New]                          = L"New";
    m_qKeyTextMap[Key_Open]                         = L"Open";
    m_qKeyTextMap[Key_Find]                         = L"Find";
    m_qKeyTextMap[Key_Undo]                         = L"Undo";
    m_qKeyTextMap[Key_Redo]                         = L"Redo";
    m_qKeyTextMap[Key_MediaLast]                    = L"MediaLast";
    m_qKeyTextMap[Key_Select]                       = L"Select";
    m_qKeyTextMap[Key_Yes]                          = L"Yes";
    m_qKeyTextMap[Key_No]                           = L"No";
    m_qKeyTextMap[Key_Cancel]                       = L"Cancel";
    m_qKeyTextMap[Key_Printer]                      = L"Printer";
    m_qKeyTextMap[Key_Execute]                      = L"Execute";
    m_qKeyTextMap[Key_Sleep]                        = L"Sleep";
    m_qKeyTextMap[Key_Play]                         = L"Play";
    m_qKeyTextMap[Key_Zoom]                         = L"Zoom";
    m_qKeyTextMap[Key_Exit]                         = L"Exit";
    m_qKeyTextMap[Key_Context1]                     = L"Context1";
    m_qKeyTextMap[Key_Context2]                     = L"Context2";
    m_qKeyTextMap[Key_Context3]                     = L"Context3";
    m_qKeyTextMap[Key_Context4]                     = L"Context4";
    m_qKeyTextMap[Key_Call]                         = L"Call";
    m_qKeyTextMap[Key_Hangup]                       = L"Hangup";
    m_qKeyTextMap[Key_Flip]                         = L"Flip";
    m_qKeyTextMap[Key_ToggleCallHangup]             = L"ToggleCallHangup";
    m_qKeyTextMap[Key_VoiceDial]                    = L"VoiceDial";
    m_qKeyTextMap[Key_LastNumberRedial]             = L"LastNumberRedial";
    m_qKeyTextMap[Key_Camera]                       = L"Camera";
    m_qKeyTextMap[Key_CameraFocus]                  = L"CameraFocus";
    m_qKeyTextMap[Key_unknown]                      = L"unknown";

    for(std::map<int,std::wstring>::iterator iter = m_qKeyTextMap.begin();iter != m_qKeyTextMap.end();iter++)
    {
        m_qTextKeyMap[iter->second] =  iter->first;
    }
}

void QKeyTextMap::InitializeModifierText( void )
{
    m_qModifierTextMap[NoModifier]           = L"NoModifier";
    m_qModifierTextMap[ShiftModifier]        = L"ShiftModifier";
    m_qModifierTextMap[ControlModifier]      = L"ControlModifier";
    m_qModifierTextMap[AltModifier]          = L"AltModifier";
    m_qModifierTextMap[MetaModifier]         = L"MetaModifier";
    m_qModifierTextMap[KeypadModifier]       = L"KeypadModifier";
    m_qModifierTextMap[GroupSwitchModifier]  = L"GroupSwitchModifier";
    m_qModifierTextMap[KeyboardModifierMask] = L"KeyboardModifierMask";

    //Shift、Control、Alt组合的情况
    m_qModifierTextMap[ShiftModifier + ControlModifier]                        = L"ShiftModifier/ControlModifier";
    m_qModifierTextMap[ShiftModifier + AltModifier]                            = L"ShiftModifier/AltModifier";
    m_qModifierTextMap[ControlModifier + AltModifier]                          = L"ControlModifier/AltModifier";
    m_qModifierTextMap[ShiftModifier + ControlModifier + AltModifier]          = L"ShiftModifier/ControlModifier/AltModifier";

    for(std::map<int,std::wstring>::iterator iter = m_qModifierTextMap.begin();iter != m_qModifierTextMap.end();iter++)
    {
        m_qTextModifierMap[iter->second] = iter->first;
    }
}

QKeyTextMap& QKeyTextMap::Singleton()
{
    static QKeyTextMap qKeyTextMap;
    return qKeyTextMap;
}
